/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.elan.action.model.impl;

import com.elan.action.model.user1;
import com.elan.action.model.user1Model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import java.io.Serializable;

import java.sql.Types;

/**
 * The base model implementation for the user1 service. Represents a row in the &quot;action_user1&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.elan.action.model.user1Model} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link user1Impl}.
 * </p>
 *
 * @author Elan
 * @see user1Impl
 * @see com.elan.action.model.user1
 * @see com.elan.action.model.user1Model
 * @generated
 */
public class user1ModelImpl extends BaseModelImpl<user1> implements user1Model {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a user1 model instance should use the {@link com.elan.action.model.user1} interface instead.
	 */
	public static final String TABLE_NAME = "action_user1";
	public static final Object[][] TABLE_COLUMNS = {
			{ "actionId", Types.BIGINT },
			{ "userName", Types.VARCHAR },
			{ "password_", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table action_user1 (actionId LONG not null primary key,userName VARCHAR(75) null,password_ VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table action_user1";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.elan.action.model.user1"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.elan.action.model.user1"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = false;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.elan.action.model.user1"));

	public user1ModelImpl() {
	}

	public long getPrimaryKey() {
		return _actionId;
	}

	public void setPrimaryKey(long primaryKey) {
		setActionId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_actionId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return user1.class;
	}

	public String getModelClassName() {
		return user1.class.getName();
	}

	public long getActionId() {
		return _actionId;
	}

	public void setActionId(long actionId) {
		_actionId = actionId;
	}

	public String getUserName() {
		if (_userName == null) {
			return StringPool.BLANK;
		}
		else {
			return _userName;
		}
	}

	public void setUserName(String userName) {
		_userName = userName;
	}

	public String getPassword() {
		if (_password == null) {
			return StringPool.BLANK;
		}
		else {
			return _password;
		}
	}

	public void setPassword(String password) {
		_password = password;
	}

	@Override
	public user1 toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (user1)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
					user1.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	@Override
	public Object clone() {
		user1Impl user1Impl = new user1Impl();

		user1Impl.setActionId(getActionId());
		user1Impl.setUserName(getUserName());
		user1Impl.setPassword(getPassword());

		user1Impl.resetOriginalValues();

		return user1Impl;
	}

	public int compareTo(user1 user1) {
		long primaryKey = user1.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		user1 user1 = null;

		try {
			user1 = (user1)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = user1.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<user1> toCacheModel() {
		user1CacheModel user1CacheModel = new user1CacheModel();

		user1CacheModel.actionId = getActionId();

		user1CacheModel.userName = getUserName();

		String userName = user1CacheModel.userName;

		if ((userName != null) && (userName.length() == 0)) {
			user1CacheModel.userName = null;
		}

		user1CacheModel.password = getPassword();

		String password = user1CacheModel.password;

		if ((password != null) && (password.length() == 0)) {
			user1CacheModel.password = null;
		}

		return user1CacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{actionId=");
		sb.append(getActionId());
		sb.append(", userName=");
		sb.append(getUserName());
		sb.append(", password=");
		sb.append(getPassword());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(13);

		sb.append("<model><model-name>");
		sb.append("com.elan.action.model.user1");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>actionId</column-name><column-value><![CDATA[");
		sb.append(getActionId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userName</column-name><column-value><![CDATA[");
		sb.append(getUserName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>password</column-name><column-value><![CDATA[");
		sb.append(getPassword());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = user1.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			user1.class
		};
	private long _actionId;
	private String _userName;
	private String _password;
	private transient ExpandoBridge _expandoBridge;
	private user1 _escapedModelProxy;
}